import {request} from '@utils/http'
import {  IDepList, IDistrictList, IDocterList, IFirDepartmentData, IHospitalDetail, IHospitalListParams, IHospitalListResponse, IScheduleResponse } from './model/hospitalListType'
import exp from 'constants'
// 根据数据获取地区列表数据
export const getDistrictList = (id: number) => {
    return request.get<any, IDistrictList>('/admin/cmn/dict/findByParentId/' + id)
}

// 获取医院列表数据
export const getHospitalList = ({page,limit,hoscode,hosname,hostype,provinceCode,cityCode,districtCode,status}:IHospitalListParams ) => {
    return request.get<any,IHospitalListResponse>(`/admin/hosp/hospital/${page}/${limit}`, {
        params: {
            hoscode,
            hosname,
            hostype,
            provinceCode,
            cityCode,
            districtCode,
            status
        }
    })
}


// 获取每个医院的详情
export const getHospitalDetail = (id: string) => {
    return request.get<any, IHospitalDetail>('/admin/hosp/hospital/show/' + id)
}

// 改变医院状态
export const changeStatus = (id:string, status:number) =>{
    return request.get<any,null>(`admin/hosp/hospital/updateStatus/${id}/${status}`)
}

// 获取医院科室详情
export const getDepartmentList = (hopcode: string) => {
    return request.get<any,IDepList>(`/admin/hosp/department/${hopcode}`)
}

// 获取医院科室排版分页列表数据
export const getScheduleList = (page: number, limit:number,hoscode: string,depcode: string) => {
    return request.get<any,IScheduleResponse>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

// 获取医院排版医生详情
export const getDocterList = (hoscode: string,depcode: string,workDate: string) => {
    return request.get<any,IDocterList>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}











